System and method for identifying devices behind network address translators

ABSTRACT

An apparatus for monitoring a plurality of devices that use a plurality of networks includes a network interface and a processor. The processor is configured to receive, via the network interface, a plurality of packets that were collectively communicated, from the devices, via all of the networks, to aggregate the packets, using at least one field that is included in respective packet headers of the packets, into a plurality of packet aggregations, such that all of the packets in each one of the packet aggregations were collectively communicated from no more than one of the devices, to group the packet aggregations into a plurality of groups, such that there is a one-to-one correspondence between the groups and the devices, in that all of the packets in each of the groups were collectively communicated from a different respective one of the devices, and to generate an output in response thereto.

FIELD OF THE DISCLOSURE

The present disclosure relates generally to communication over computer networks.

BACKGROUND OF THE DISCLOSURE

U.S. Pat. No. 7,882,217, whose disclosure is incorporated herein by reference, describes a computer-implemented method for communication analysis. The method includes monitoring communication sessions, which are conducted by entities in a communication network. Identifiers that identify the entities are extracted from the monitored sessions. The identifiers extracted from the sessions are grouped in respective identity clusters, each identity cluster identifying a respective entity. A subset of the identity clusters, which includes identifiers that identify a target entity, is merged to form a merged identity cluster that identifies the target entity. An activity of the target entity in the communication network is tracked using the merged identity cluster.

U.S. Pat. No. 8,665,728, whose disclosure is incorporated herein by reference, describes methods and systems for identifying network users who communicate with the network (e.g., the Internet) via a given network connection. The disclosed techniques analyze traffic that flows in the network to determine, for example, whether the given network connection serves a single individual or multiple individuals, a single computer or multiple computers. A Profiling System (PS) acquires copies of data traffic that flow through network connections that connect computers to the WAN. The PS analyzes the acquired data, attempting to identify individuals who login to servers.

Bellovin, Steven M. “A technique for counting NATted hosts,” Proceedings of the 2nd ACM SIGCOMM Workshop on Internet measurment, ACM, 2002, which is incorporated herein by reference, describes a technique for detecting NATs and counting the number of active hosts behind them. The technique is based on the observation that on many operating systems, the IP header's ID field is a simple counter. By suitable processing of trace data, packets emanating from individual machines can be isolated, and the number of machines determined.

Bursztein, Elie, “Time has something to tell us about network address translation,” Proc. of NordSec. 2007, which is incorporated herein by reference, describes a new technique to count the number of hosts behind a NAT. This technique is based on the TCP timestamp, and works with Linux and BSD systems.

Gokcen, Yasemin, and Vahid Aghaei Foroushani, “Can we identify NAT behavior by analyzing Traffic Flows?” Security and Privacy Workshops (SPW), 2014, IEEE, 2014, which is incorporated herein by reference, describes a machine learning (ML) approach to identifying malicious behaviors using only network flows. The proposed approach is evaluated on different traffic data sets against passive fingerprinting approaches.

Gokcen, Yasemin, “A preliminary study for identifying NAT traffic using machine learning,” (2014), which is incorporated herein by reference, describes identifying the presence of NAT devices and (if possible) predicting the number of users behind those NAT devices. Gokcen utilizes different approaches and evaluates the performance of these approaches under different network environments represented by the availability of different data fields. To achieve this, Gokcen proposes a machine learning (ML) based approach to detect NAT devices.

SUMMARY OF THE DISCLOSURE

There is provided, in accordance with some embodiments of the present disclosure, apparatus for monitoring a plurality of devices that use a plurality of networks, the apparatus including a network interface and a processor. The processor is configured to receive, via the network interface, a plurality of packets that were collectively communicated, from the devices, via all of the networks, to aggregate the packets, using at least one field that is included in respective packet headers of the packets, into a plurality of packet aggregations, such that all of the packets in each one of the packet aggregations were collectively communicated from no more than one of the devices, to group the packet aggregations, based on information contained in the packet aggregations, into a plurality of groups, such that there is a one-to-one correspondence between the groups and the devices, in that all of the packets in each of the groups were collectively communicated from a different respective one of the devices, and to generate an output in response to the grouping.

In some embodiments, at least one of the networks is serviced by a network address translator (NAT).

In some embodiments, the processor is configured to group the packet aggregations by:

for each packet aggregation of the packet aggregations:

-   -   identifying, in at least one packet of packets belonging to the         packet aggregation, at least one device identifier that uniquely         identifies the one of the devices from which the packet was         communicated, and     -   using the identified device identifier, associating the packet         aggregation with the one of the devices from which the packets         belonging to the packet aggregation were communicated.

In some embodiments, the device identifier is selected from the group consisting of: an Internet cookie, an identifier for advertisers (IDFA), an identifier for vendors (IDFV), an Android advertising identifier (AAID), a universally unique identifier (UUID), an international mobile station equipment identity (IMEI), an international mobile subscriber identity (IMSI), and a media access control (MAC) address.

In some embodiments, the processor is configured to identify the device identifier by decoding the at least one packet belonging to the packet aggregation.

In some embodiments, the processor is configured to group the packet aggregations by:

for each packet aggregation of the packet aggregations:

-   -   identifying, in at least one packet belonging to the packet         aggregation, at least one device identifier,     -   in response to the identified device identifier, calculating a         likelihood that the packets belonging to the packet aggregation         were communicated from a particular one of the devices, and     -   associating the packet aggregation with the particular one of         the devices, with the calculated likelihood.

In some embodiments, the field is an internet protocol identification (IPID).

In some embodiments, in aggregating the packets into the plurality of packet aggregations, the processor is configured to aggregate, into any given packet aggregation of the packet aggregations, any given packet of the packets, in response to at least one of:

the given packet belonging to the same transmission control protocol (TCP) connection as does a last-received packet of the given packet aggregation, and

a TCP timestamp included in the given packet being within an expected offset range from a TCP timestamp included in the last-received packet of the given packet aggregation.

In some embodiments, the processor is further configured to compute the expected offset range by applying a machine-learned model that computes the expected offset range.

In some embodiments, the machine-learned model computes the expected offset range by assuming that a rate of increase of the TCP timestamp varies as a function of a time of day.

In some embodiments, the processor is configured to group the packet aggregations by:

identifying respective device-usage characteristics exhibited by the packet aggregations, and

based on the device-usage characteristics, grouping the packet aggregations into the plurality of groups.

In some embodiments, the device-usage characteristics are at least partly based on destination internet protocol (IP) addresses included in the packet aggregations.

In some embodiments, the processor is configured to group the packet aggregations by:

computing, for each packet aggregation of the packet aggregations, a characteristic vector, each element of the vector corresponding to a different respective destination IP address, and a value of the element representing a number of times, in the packet aggregation, that a connection was established with the destination IP address,

subsequently, reducing a dimensionality of each characteristic vector, and

subsequently, grouping any given first one of the packet aggregations with a second one of the packet aggregations, in response to an angle between the characteristic vector of the first one of the packet aggregations and the characteristic vector of the second one of the packet aggregations being less than a threshold.

In some embodiments, the device-usage characteristics are at least partly based on respective times at which the packets were communicated.

In some embodiments, the device-usage characteristics are at least partly based on domain name system (DNS) queries included in the packet aggregations.

In some embodiments,

packet aggregations are a second plurality of packet aggregations and the plurality of groups are a second plurality of groups, and

the processor is configured to group the second plurality of packet aggregations into the second plurality of groups, by:

-   -   grouping a first plurality of packet aggregations into a first         plurality of groups, based on device identifiers identified in         the first plurality of packet aggregations,     -   from the first plurality of groups, learning a rule for grouping         packet aggregations based on the device-usage characteristics,         and     -   using the rule, grouping the second plurality of packet         aggregations into the second plurality of groups.

There is further provided, in accordance with some embodiments of the present disclosure, apparatus for monitoring a plurality of devices that use at least one network that is serviced by a network address translator (NAT), the apparatus including a network interface and a processor. The processor is configured to receive, via the network interface, a plurality of packets that were communicated from the devices via the network, to aggregate the packets, using at least one field that is included in respective packet headers of the packets, into a plurality of packet aggregations, such that all of the packets in each one of the packet aggregations were collectively communicated from no more than one of the devices. The processor is further configured, for each packet aggregation of the packet aggregations, to identify, in at least one packet in the packet aggregation, at least one device identifier that uniquely identifies the one of the devices from which the packet was communicated, and to associate the packet aggregation, based on the identified device identifier, with the one of the devices. The processor is further configured to generate an output in response to the associating.

There is further provided, in accordance with some embodiments of the present disclosure, a method for monitoring a plurality of devices that use a plurality of networks. The method includes, using at least one field that is included in respective packet headers of a plurality of packets that were collectively communicated from the devices via all of the networks, aggregating the packets into a plurality of packet aggregations, such that all of the packets in each one of the packet aggregations were collectively communicated from no more than one of the devices. The method further includes, based on information contained in the packet aggregations, grouping the packet aggregations into a plurality of groups, such that there is a one-to-one correspondence between the groups and the devices, in that all of the packets in each of the groups were collectively communicated from a different respective one of the devices, and generating an output in response to the grouping.

There is further provided, in accordance with some embodiments of the present disclosure, a method for monitoring a plurality of devices that use at least one network that is serviced by a network address translator (NAT). The method includes, using at least one field that is included in respective packet headers of a plurality of packets that were communicated from the devices via the network, aggregating the packets into a plurality of packet aggregations, such that all of the packets in each one of the packet aggregations were collectively communicated from no more than one of the devices. The method further includes, for each packet aggregation of the packet aggregations, identifying, in at least one packet in the packet aggregation, at least one device identifier that uniquely identifies the one of the devices from which the packet was communicated, and, based on the identified device identifier, associating the packet aggregation with the one of the devices. The method further includes generating an output in response to the associating.

The present disclosure will be more fully understood from the following detailed description of embodiments thereof, taken together with the drawings, in which:

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a schematic illustration of a system for identifying devices behind a NAT, in accordance with some embodiments described herein;

FIG. 2 is a flow diagram of a method performed by a processor to group packets with each other, in accordance with some embodiments described herein;

FIG. 3 is a schematic illustration showing the grouping of packets, in accordance with some embodiments described herein; and

FIG. 4 shows a plot illustrating a method for aggregating packets based on their TCP timestamps, in accordance with some embodiments described herein.

DETAILED DESCRIPTION OF EMBODIMENTS Overview

A network address translator (NAT) maps one internet protocol (IP) space to another IP space, by modifying network address information contained in packet headers as they pass through a routing device. For example, a NAT may map multiple private hosts to one publicly-exposed IP address, such that all traffic emanating from a particular local area network (LAN) may be appear to originate from a single host.

The obfuscatory behavior of NATs poses a challenge to entities that wish to monitor communication exchanged with particular devices, or to discover which devices belong to a particular LAN. This challenge is amplified by the fact that a particular device may use multiple networks (and, perhaps, multiple NATs) at different times.

Embodiments described herein address this challenge, thus allowing the activity on LANs to be effectively monitored. In particular, embodiments described herein provide systems and methods for associating packets with the devices from which they were communicated, despite the obfuscatory behavior of any NATs. Embodiments described herein may be applied to lawful monitoring of communication (e.g., by the Police or Homeland Security), traffic management, network management, parental control, quality-of-service monitoring, or any other relevant application.

In embodiments described herein, a processor first receives (e.g., via a network tap) packets that were collectively communicated, by a plurality of devices, via a NAT-serviced LAN. As a first step in associating each of these packets with the device from which it was communicated, the processor aggregates the packets into multiple packet aggregations, each packet aggregation including packets that were collectively communicated from no more than one device. To perform the aggregation, fields that are contained in the respective packet headers of the packets, such as a transmission control protocol (TCP) 5-tuple, an internet protocol identification (IPID), or a TCP timestamp, are used.

For example, in some embodiments, the processor ascertains that a plurality of received packets belong to the same TCP connection (and hence, were communicated from the same device), based on these packets having identical TCP 5-tuples. The processor may therefore aggregate these packets into a common packet aggregation. Subsequently, upon receiving another packet having a different TCP 5-tuple, the processor may ascertain that this packet, too, was communicated from the same device, given that the TCP timestamp of this packet is within an expected offset range from the TCP timestamp of the last-received packet of the packet aggregation. The processor may therefore aggregate this packet (and any subsequently-received packets belonging to the same TCP connection as this packet) into the same packet aggregation.

Over relatively short periods of time, the above-described aggregation of packets may yield a one-to-one correspondence between packet aggregations and devices, in that each device may have exactly one corresponding packet aggregation. Over longer periods of time, however, the fields used for aggregation are likely to be reset, and therefore, a device may accrue more than one corresponding packet aggregation. Hence, the present disclosure also provides techniques for grouping the packet aggregations, such that each device has exactly one corresponding group of packet aggregations, even over long periods of time. Such grouping may be performed by one or both of the following techniques:

(i) A uniquely-assigned device identifier, such as an Internet cookie, may be identified in at least one of the packets in a particular packet aggregation. Subsequently, using the device identifier, the packet aggregation may be associated with the device from which the packets in the packet aggregation were communicated. (Even if only one packet in the packet aggregation includes the identifier, the entire packet aggregation may be associated with the device, since it is known that the entire packet aggregation was communicated from a single device.) In this manner, multiple packet aggregations may be grouped together, in association with a single device, based on each of these packet aggregations including the uniquely-assigned device identifier of the device.

(ii) Device-usage characteristics exhibited by the packet aggregation may be used to group the packet aggregation together with other packet aggregations that originated from the same device. For example, if two particular packet aggregations tend to access similar network resources, as evidenced by a similar pattern of domain name system (DNS) queries or Internet Protocol (IP) addresses that appear in the packet aggregations, it may be ascertained that the two packet aggregations originated from the same device. In this manner, the number of devices behind a particular NAT, in addition to the usage characteristics of the devices, may be ascertained, even if no device identifiers are identified in the packets.

Typically, the processor monitors multiple networks, such as multiple LANs (each of which may be serviced by a respective NAT), and/or cellular networks. Advantageously, the above-described grouping techniques may be effective even if a particular device uses more than one of these networks (i.e., the techniques may be used to group together packet aggregations across a plurality of these networks), since the device identifiers and device-usage characteristics used for the grouping typically do not change as a device moves between different networks.

An advantage of embodiments described herein is that the application layer of communication, which is often encrypted, is not exclusively relied upon for aggregating or grouping the packets. Rather, embodiments described herein may use unencrypted lower-level information (including, for example, IPIDs and domain names), such that aggregation and grouping may be successfully performed even if information in the application layer is encrypted.

System Description

Reference is initially made to FIG. 1, which is a schematic illustration of a system 20 for identifying devices behind a NAT, in accordance with some embodiments described herein.

FIG. 1 depicts a plurality of devices 24 a, 24 b, and 24 c using a LAN 22. A NAT 26 performs network address translation as described above, such that the headers of all packets communicated from NAT 26 to the Internet 28 share a common source IP address. Similarly, all packets communicated from the Internet to the NAT share a common destination IP Address.

Devices 24 a-c do not necessarily remain in LAN 22; rather, any one of the devices may also use any other network at any given time. For example, FIG. 1 shows device 24 a using, at a different time, a second LAN 23, which is shared by another device 29 and is serviced by a second NAT 27. At yet another time, device 24 a may use a cellular network 25, shared by another device 31. Thus, to identify communication from device 24 a, at least two challenges must be addressed: (i) communication from device 24 a must be differentiated from communication from other devices, and (ii) communication from device 24 a must be identified regardless of which network is used by the device.

To address these challenges, a server 30 (e.g., belonging to a monitoring station) monitors communication exchanged between LAN 22, LAN 23, and cellular network 25 (as well as any number of other LANs or other types of networks), and the Internet. Specifically, exchanged packets—and in particular, packets communicated from the networks—are received en-route by one or more network taps, which pass the packets to a server 30. Server 30 receives the packets via a network interface, such as a NIC 32, and a processor 34, belonging to the server, then processes the packets, as described in detail hereinbelow, such as to identify the source of each packet.

In general, processor 34 may be embodied as a single processor, or a cooperatively networked or clustered set of processors. Processor 34 is typically a programmed digital computing device comprising a central processing unit (CPU), random access memory (RAM), non-volatile secondary storage, such as a hard drive or CD ROM drive, network interfaces, and/or peripheral devices. Program code, including software programs, and/or data are loaded into the RAM for execution and processing by the CPU and results are generated for display, output, transmittal, or storage, as is known in the art. The program code and/or data may be downloaded to the computer in electronic form, over a network, for example, or it may, alternatively or additionally, be provided and/or stored on non-transitory tangible media, such as magnetic, optical, or electronic memory. Such program code and/or data, when provided to the processor, produce a machine or special-purpose computer, configured to perform the tasks described herein.

Reference is now made to FIG. 2, which is a flow diagram of a method performed by processor 34 to group packets with each other, and to FIG. 3, which is a schematic illustration showing the grouping of packets per the method of FIG. 2, in accordance with some embodiments described herein.

FIG. 2 shows two stages of operation. In a first stage 47, the processor receives the packets, and aggregates the packets into a plurality of packet aggregations, such that each packet aggregation includes packets that were collectively communicated from no more than one of the devices that uses LAN 22. Five such packet aggregations, numbered 36 a through 36 e, are shown in FIG. 3. Each of the packet aggregations may include any number of packets. By way of illustration, packet aggregations 36 a-e are shown containing, respectively, J, K, L, M, and N packets, where J, K, L, M, and N are positive integers. Further details regarding first stage 47 are described below.

As described above in the Overview, over time, as the relevant fields (e.g., IPIDs) are reset, the number of packet aggregations will tend to exceed the number of devices by a greater and greater margin. Hence, in a second stage 53, the processor groups the packet aggregations together, such that no more than one group corresponds to a particular device. (In other words, the correspondence between groups and devices is one-to-one, such that all of the packets belonging to each group were collectively communicated from a single respective one of the devices.) The grouping of packet aggregations is illustrated in FIG. 3, which shows, for example, packet aggregations 36 a and 36 b being grouped together, in association with device 24 a. Further details regarding second stage 53 are described below.

First stage 47 and second stage 53 may be performed in alternation, as indicated by the arrows that connect first stage 47 and second stage 53 in FIG. 2. For example, upon receiving a packet that includes a device identifier, the processor may add the packet to the appropriate packet aggregation (first stage 47), then use the device identifier to associate the packet aggregation with the appropriate device (second stage 53), and then continue to add incoming packets to the packet aggregation (first stage 47).

Alternatively, first stage 47 and second stage 53 may be performed simultaneously, e.g., on separate threads executed by the processor. For example, while aggregating incoming packets into various packet aggregations (first stage 47), the processor may identify device-usage characteristics in the packet aggregations, and/or group packet aggregations with each other (second stage 53).

First Stage 47

As described above, in first stage 47, the processor aggregates the packets that are received. To aggregate the packets, the processor uses at least one field that is included in respective packet headers of the packets. In some embodiments, this field is incremented by a device in a predictable manner as successive packets are communicated from the device, such that, upon observing a sequence of values of this field across multiple packets, it may be ascertained that the multiple packets were communicated from the same device. For example, each packet that is communicated from some versions of the Windows (R) operating system includes, in the packet's header, an internet protocol identification (IPID), which is incremented by one for each successive packet. The IPID may thus be used to aggregate the packets.

For example, with reference to both FIG. 2 and FIG. 3, the processor may first receive, at a packet-receiving step 48, a packet 38 that includes, in the packet's header, an IPID of 12345. The processor then checks, at a checking step 50, whether packet 38 belongs to an existing packet aggregation, by checking whether 12345 continues a sequence of IPIDs in any of the existing packet aggregations. If not, the processor creates a new packet aggregation 36 e, at a packet-aggregation-creating step 51. The processor then, at an aggregating step 52, aggregates packet 38 into the new packet aggregation.

The processor may then receive, at packet-receiving step 48, a second packet (not explicitly identified in FIG. 3) that includes an IPID of 65789. At checking step 50, the processor identifies that 65789 is not in sequence with 12345, and therefore the processor aggregates the second received packet separately from packet 38.

The processor may then receive another packet 40 that includes an IPID of 12346. At checking step 50, the processor ascertains that packet 40 belongs to packet aggregation 36 e, since the numerical sequentiality of the IPIDs of packets 38 and 40 indicates that packets 38 and 40 were likely communicated from the same device. (In FIG. 3, these two packets are depicted as having been communicated from device 24 c.) The processor therefore aggregates packet 40 together with packet 38, at aggregating step 52.

It is noted that although the IPID is incremented by one for each successive packet, packets that do not leave the LAN are not received by server 30, and thus, there may be gaps in the sequentiality of the IPIDs. For example, after receiving a packet from device 24 c that includes an IPID of 12345, the next packet from device 24 c received by the processor may include an IPID of 12360. Hence, to identify that 12360 belongs to the same sequence of IPIDs as 12345, the processor may look at additional information contained in the packets, such as the respective TCP 5-tuples of the packets. If the two 5-tuples are identical, the processor ascertains that the two packets belong to the same TCP connection (and hence, emanate from the same device), notwithstanding the discontinuity in the IPID sequence.

In some cases, the processor may use domain-related information included in the packets to aggregate the packets. For example, device 24 a may first establish a connection with a first domain, by transmitting an appropriate domain name system (DNS) query. Subsequently, device 24 a may begin transmitting packets that are associated with the connection. Based on common domain-related information (e.g., a common IP address) in the packets, the processor identifies that these packets belong to a common connection, and therefore aggregates the packets with each other, as well as with the preceding DNS query.

In some operating systems (e.g., Windows 8 (R)), the IPIDs of successive DNS queries are sequential, even though the IPIDs of successively transmitted packets are generally not sequential. Hence, for such operating systems, the processor may additionally aggregate together packets that are associated with multiple respective connections. For example, supposing that the aforementioned DNS query had an IPID of 100, device 24 a may, subsequently, transmit a second DNS query having an IPID of 101. Based on the sequentiality of the IPIDs, the processor may aggregate the second DNS query, and subsequent packets associated with the second connection, with the previously-aggregated packets associated with the first connection.

In some cases, the “source port” field, which, in the Windows (R) operating system, is incremented for each successive connection, may be used to aggregate the packets. In other words, each received packet may be aggregated together with a previously-received packet, based on the two packets having respective source ports that are the same as one another, or that follow one another in sequence. Such a technique may work if (as is sometimes the case) the NAT preserves the source port field in packets that exit the LAN, or if no NAT is present.

For example, device 24 a may first establish a connection with a first domain, and subsequently transmit packets associated with the connection and having a source port of 100. Based on the common source port, the processor may aggregate the packets together. Subsequently, device 24 a may establish a connection with a second domain, and accordingly increment the source port field to 101 in associated packets. Based on the sequentiality of the source port, the processor may ascertain that these latter packets, which are associated with the second connection, should be aggregated with the previously-received packets, which are associated with the first connection.

Although, as noted above, each of the packet aggregations includes packets that were collectively communicated from no more than one device, there is not necessarily a one-to-one correspondence between packet aggregations and devices; rather, the correspondence may be many-to-one. For example, if device 24 c is restarted, the sequence of IPIDs emanating from device 24 c may be reset. In such a case, for example, the processor may receive a packet 42 from device 24 c having an IPID of 200. Due to 200 not sequentially following the IPID of the last packet (“Packet N”) of packet aggregation 36 e, the processor does not aggregate packet 42 in packet aggregation 36 e, but rather, initiates a separate packet aggregation 36 d.

It is emphasized that first stage 47 is performed for all of the received packets, regardless of which network(s) the packets are received from. Thus, the packet aggregations may collectively belong to a plurality of networks. For example, while packet aggregation 36 a may include packets communicated from LAN 22, packet aggregation 36 b may include packets communicated from LAN 23 or cellular network 25, rather than LAN 22.

For operating systems other than Windows (R), which do not assign IPIDs to packets, the aggregation of the packets may be based on other fields included in the packet headers. The processor may use operating-system (OS) fingerprinting techniques to determine from which operating system each of the packets was communicated, and hence, select an appropriate field for aggregating the packet.

For example, upon identifying a packet communicated from the Linux (R), Android (R), or iOS (R) operating system, the processor may use the TCP timestamp field, which increases linearly as a function of the clock time of the device, to aggregate the packet into a preexisting packet aggregation. This technique will now be described in detail, with reference now being made to FIG. 4, which shows a plot 75 illustrating a method for aggregating packets based on their TCP timestamps, in accordance with some embodiments described herein. Each packet received by the processor is indicated in plot 75 by a respective marker 68, which is plotted at the horizontal position corresponding to the time at which the packet was received, and at the vertical position corresponding to the TCP timestamp (TS) of the packet. (For ease of description, the paragraphs below may refer to particular markers, which are labeled in FIG. 4, as “packets,” given that, as explained, these markers correspond to respective packets.)

As described above, upon receiving a given packet, the processor, at checking step 50, checks whether the packet belongs to a preexisting packet aggregation. If yes, the processor, at aggregating step 52, aggregates the packet into the appropriate preexisting packet aggregation; otherwise, the processor uses the packet to initialize a new packet aggregation. FIG. 4 illustrates a scenario in which the processor, by performing the above steps, has initialized, and augmented, three packet aggregations. Each of these packet aggregations is indicated in plot 75 by a connected sequence of markers. In particular, a first connected sequence 66 a indicates a first packet aggregation, a second connected sequence 66 b indicates a second packet aggregation, and a third connected sequence 66 c indicates a third packet aggregation. (For ease of description, each such connected sequence may be referred to as a “packet aggregation,” given that the connected sequence indicates a packet aggregation.)

It is noted that the TCP timestamp of a device tends to increase at a rate that varies in response to various factors, such as the degree to which the battery of the device is charged, and whether the battery of the device is currently being charged. Hence, the TCP timestamp tends to increase in a piecewise linear fashion. Such a piecewise linear increase is indicated in FIG. 4 for packet aggregation 66 a. In particular, the line that connects the markers for this packet aggregation includes two segments having different respective slopes: a first segment having a slope m1, and a second segment having a slope m2 that is less than m1.

Per the technique illustrated in FIG. 4, two packets may be aggregated together in response to at least one of two conditions being met. First, the packets may be aggregated together if they belong to the same TCP connection, as evidenced by the two packets sharing a common TCP 5-tuple, as described above with reference to FIGS. 2-3. Second, the packets may be aggregated together if the TCP timestamp included in the later packet—more specifically, in the header thereof—is within an expected offset range from the TCP timestamp included in the earlier packet.

Hence, upon receiving a packet, the processor first checks, at checking step 50, whether the newly-received packet belongs to the same TCP connection as the last-received packet in any of the existing packet aggregations. If not—i.e., if the newly-received packet belongs to a TCP connection that was not heretofore seen—the processor next checks whether the TCP timestamp of the newly-received packet is within an expected offset range from the TCP timestamp of one of the last-received packets. (The last-received packet of a packet aggregation has the highest TCP timestamp in the packet aggregation.) If yes, the processor aggregates the newly-received packet into the appropriate packet aggregation. Otherwise, the processor initializes a new packet aggregation with the newly-received packet.

In some embodiments, the processor computes the expected offset range for a given packet aggregation, based on the rate of increase of the TCP timestamp over the last few minutes (e.g., the last 5-30 minutes) in the packet aggregation during which packets were received. In particular, the processor may define an expected offset range that straddles the offset that would be obtained with this historical rate of increase. For example, the processor may ascertain that m2=100 s⁻¹, i.e., the processor may ascertain that the TCP timestamp in packet aggregation 66 a recently increased by 100 per second. In response thereto, the processor may define an expected TCP timestamp rate-of-increase range that straddles 100 s⁻¹, such as a range of between 90 s⁻¹ and 120 s⁻¹. This range, in turn, implies an expected offset range for any subsequently received packet. For example, for an expected TCP timestamp rate-of-increase range of 90-120 s⁻¹, a packet received dt seconds after the last-received packet of packet aggregation 66 a would have an expected offset range of between 90*dt and 120*dt. Thus, for example, if the last-received packet in packet aggregation 66 a has a TCP timestamp of 700 and was received at a time of 10 seconds, the processor may compute an expected offset range of between 745 and 760 for a packet subsequently received at 10.5 seconds. In other words, if the TCP timestamp of the subsequently-received packet lies between 745 and 760, the processor may aggregate the subsequently-received packet into packet aggregation 66 a. Otherwise, the processor may aggregate the subsequently-received packet into another packet aggregation, or use the subsequently-received packet to initialize a new packet aggregation.

FIG. 4 illustrates expected offset ranges for each packet aggregation, by showing hypothetical extension lines 76 that extend from the last-received packet of the packet aggregation. Any packet received subsequently to the last-received packet is aggregated into the packet aggregation, only if the TCP timestamp of the packet lies between the extension lines 76 for the packet aggregation. Thus, for example, a packet 70, received at time t1, is not aggregated into packet aggregation 66 a, given that the TCP timestamp of packet 70 does not lie within the range 74 that lies between extension lines 76 of packet aggregation 66 a at t1. (Rather, packet 70 is aggregated into packet aggregation 66 c, as described below.)

Notwithstanding the above, in many cases the expected offset range cannot be accurately computed, based only on the rate of increase of the TCP timestamp over the last few minutes of packet history in the packet aggregation. For example, in some cases, a large duration of time may have passed from receipt of the last-received packet, such that the last few minutes of packet history are not recent. FIG. 4 illustrates such a scenario, whereby the last-received packet of packet aggregation 66 c was received at time t0, but no subsequent packet belonging to packet aggregation 66 c was received prior to time t1, which is significantly later than t0. In such a scenario, the rate of increase of the TCP timestamp is likely to have changed between t0 and t1.

To address this challenge, embodiments of the present disclosure further provide more sophisticated techniques for computing the expected offset ranges. For example, the processor may apply a machine-learned model that computes the expected offset range. Such a model may assume that the rate of increase of the TCP timestamp varies as a function of various parameters that may be extracted from a packet aggregation, such as the receipt times of the packets, network latency, an average bandwidth used by the device, TCP retransmission rates, average connection lengths, and the rate of new connections per second. Hence, given a packet aggregation as input, the model may compute an expected offset range for the packet aggregation.

Alternatively or additionally, the machine-learned model may assume that the rate of increase of the TCP timestamp varies as a function of a time of day, in that, for example, the battery charge level of the device varies over the course of the day. Thus, for example, the model may predict a greater rate of increase during times at which the battery of the device is more likely to be fully (or mostly) charged, such as at the beginning of the morning. Alternatively or additionally, the model may predict a greater rate of increase during times at which the battery of the device is more likely to be currently charging, such as at nighttime.

In some embodiments, the machine-learned model is a deep neural network (DNN), such as a DNN having an autoencoder architecture. Such a network may be trained (daily, for example) on an input data set that includes a large number of TCP connections. Based on this input, the network may learn the parameters that influence, or correlate with, the rate of increase of the TCP timestamp. (Examples of such parameters are provided above.) Subsequently, upon being provided with a packet aggregation, the network may extract these parameters from the packet aggregation, and then use these parameters to compute the expected offset range.

For example, upon receiving packet 70, which belongs to a TCP connection not heretofore seen, the processor may pass packet aggregation 66 c into a trained DNN. The DNN may then predict the rate of increase of the TCP timestamp between t0 and t1, and thus, compute an expected offset range for t1. The processor may then aggregate packet 70 into packet aggregation 66 c, based on the TCP timestamp of packet 70 being within the expected offset range from the TCP timestamp of packet 72, the last-received packet of packet aggregation 66 c.

Second Stage 53

Reference is again made to FIGS. 2-3.

During, and/or following, the formation of each packet aggregation, the processor selects the packet aggregation, at a selecting step 54. The processor then attempts to extract, from the packet aggregation, relevant information that may be used to associate the packet aggregation with a specific device, or at least group the packet aggregation with other packet aggregations that were communicated from the same device. First, at a characteristic-identifying step 60, the processor identifies device-usage characteristics that are exhibited by the packet aggregation. As further described below, such characteristics may be used to group the packet aggregation with other packet aggregations that exhibit similar characteristics.

Next, at a device-identifier-seeking step 56 (which, in some embodiments, may be performed prior to characteristic-identifying step 60), the processor attempts to identify, in at least one packet belonging to the packet aggregation, at least one device identifier that uniquely identifies the device from which the packet was communicated. Such a device identifier may be used to associate the packet aggregation with a particular device, and thus, by definition, group the packet aggregation together with other packet aggregations associated with the same device.

In general, a suitable device identifier is that which is assigned uniquely per device, such that, with a relatively high probability, over a relatively long period of time, no two devices will share the same such identifier. For example, in the context of the present application, including the claims, a device identifier may be said to “uniquely identify” a particular device if there is a probability of less than one in one million that over a period of at least one year, another device will share the same identifier. Due to being uniquely assigned, such a device identifier may be said to identify the device from which the packet (and hence, packet aggregation) was communicated.

To be suitable, the device identifier must also, typically, be persistent—i.e., it cannot change too frequently. For example, a session cookie is typically not a suitable device identifier, despite being unique. In general, a device identifier may be suitably persistent if, on average, it does not change for at least 24 hours.

Examples of suitable device identifiers include cookies communicated by various applications (e.g., “_utma,” “_cfduid,” “_gads,” “bcookie,” “obuid,” “OptimizelyEndUserId,” “taboola_fp_td_user_id,” “csrftoken,” or “_hjuserid”), identifiers for advertisers (IDFAs), identifiers for vendors (IDFVs), Android advertising identifiers (AAIDs), universally unique identifiers (UUIDs), international mobile station equipment identities (IMEIs), international mobile subscriber identities (IMSIs), and media access control (MAC) addresses.

Alternatively or additionally, any other identifier that appears consistently, unencrypted, in traffic sent from a particular application, and is assigned uniquely per device, may be used for associating a packet aggregation with a device. Such an identifier may be specific to the application (e.g., a device-specific username for the application), or unspecific to the application (e.g., a phone number of the device).

Alternatively or additionally, any suitable aggregation of “quasi-identifiers” may constitute a suitable device identifier. In other words, even if each of a plurality of identifiers is not sufficiently unique when considered alone, the plurality of identifiers may be sufficiently unique when considered in aggregation. For example, a suitable device identifier may include the aggregation of a particular Internet cookie, a user-agent identifier, and an email address.

To identify the device identifier, the processor typically decodes at least one of the packets in the packet aggregation. For example, the processor may iterate through the packets in the packet aggregation, until the processor comes across the string “IDFA:”. Recognizing the string “IDFA:”, the processor then interprets the following string as the IDFA of the device. As another example, the processor may extract a cookie, upon recognizing the appropriate preceding string (e.g., “_utma”). In some cases, the processor may perform full application decoding, i.e., the processor may extract the identifier only after first interpreting the entire content of the packet.

If the processor identifies a device identifier in the packet aggregation, the processor then checks, at a first group-seeking step 58, whether another group of packet aggregations includes the same device identifier. If yes, the processor, at a grouping step 64, groups the packet aggregation into the group of packet aggregations that shares the device identifier. (In other words, the processor associates the packet aggregation with the device, identified by the device identifier, from which the packets belonging to the packet aggregation were communicated.)

For example, FIG. 3 depicts a particular packet 44, which belongs to packet aggregation 36 a, including a particular IDFA. In response to identifying this IDFA in packet 44, the processor associates packet aggregation 36 a, in its entirety, with device 24 a, which is identified by the IDFA. (The processor does not necessarily know anything more about device 24 a, beyond the IDFA of device 24 a.) Similarly, packet aggregation 36 b, which includes a packet 45 that includes the same IDFA, is also associated with device 24 a. Packet aggregation 36 c, on the other hand, is associated with device 24 b, rather than device 24 a, given that packet aggregation 36 c includes a different IDFA from that which was identified in packet aggregations 36 a and 36 b.

By performing the device-identifier-based grouping described above, the processor facilitates identifying the number of, and respective identities of, devices that use a particular NAT. Moreover, the device identifiers allow each packet aggregation to be associated with the appropriate device, irrespective of the network from which the packet aggregation emanated. Thus, communication exchanged with any particular one of the devices may be monitored, even if the particular device moves between networks.

If, on the other hand, the packet aggregation does not include a suitable device identifier, or if no other existing group of packet aggregations includes the identified device identifier, the processor, at a second group-seeking step 57, checks whether any existing group (i) is not known to include a device identifier that is different from that of the packet aggregation, and (ii) exhibits device-usage characteristics that are similar to those that are exhibited by the packet aggregation. If yes, the packet aggregation is added to the group, at grouping step 64. Otherwise, a new group is created, at group-creating step 62, and the packet aggregation is then added to the new group.

Since the manner in which a device is used is typically not strongly dependent on the network within which the device is used, the device-usage characteristics may be used for grouping across networks. Thus, for example, device-usage characteristics may be used to group together all of the packet aggregations from device 24 a, even if some of the packet aggregations came from LAN 22, others from LAN 23, and yet others from cellular network 25.

In some embodiments, the device-usage characteristics are based on destination IP addresses included in the packet aggregations. In such embodiments, upon identifying that two packet aggregations include similar sets of destination IP addresses, the processor may group the two packet aggregations together, as this similarity indicates that the two packet aggregations emanated from the same device. (In other words, it is unlikely that two different users would independently use their respective devices to access similar sets of IP addresses.) For example, the processor may compare the overlap, between the respective sets of destination IP addresses, to a threshold, and group the two packet aggregations together if this overlap exceeds the threshold.

Alternatively or additionally, the device-usage characteristics may be based on domain name system (DNS) queries included in the packet aggregations, and/or on the respective times at which the packets, in the packet aggregations, were communicated. In this regard, some hypothetical data, assumed to have been obtained by the processor at characteristic-identifying step 60, are provided in Table 1 below. In the ensuing description, it will be assumed that packet aggregations 36 a-36 e do not include suitable device identifiers, and therefore, the grouping of packet aggregations 36 a-36 e is based solely on the device-usage characteristics in Table 1.

TABLE 1 Percent Percent Percent Percent Percent Device-usage of of of of of characteristic packets packets packets packets packets (time-based) in 36a in 36b in 36c in 36d in 36e Used between 6 50% 45%  5% 32% 10% am and 9 am Used between 9 12% 10% 85% 35%  2% am and 6 pm Used after 6 pm 38% 45% 10% 33% 88% Device-usage Percent Percent Percent Percent Percent characteristic of DNS of DNS of DNS of DNS of DNS (DNS- queries queries queries queries queries query-based) in 36a in 36b in 36c in 36d in 36e Used to 70% 52% 15% 16% 14% read the news Used for  5% 20% 10% 34% 38% social media Used for  0%  5% 63% 22% 19% trading stocks Used for 25% 23% 12% 28% 29% other uses

At second group-seeking step 57, the processor looks for similarities in the respective device-usage characteristics. For example, packet aggregations 36 a and 36 b share similar time-based usage characteristics, in that the respective percentage of total packets communicated within each time slot is approximately the same for each of these two packet aggregations. (To ascertain this similarity, the processor may verify that for each of the time slots, the respective percentages for the two packet aggregations are within a given threshold of one another, e.g., 10%.) The processor, therefore, at grouping step 64, groups packet aggregations 36 a and 36 b together, since the similarity between the respective usage characteristics indicates that the packets of packet aggregations 36 a and 36 b were communicated from a single device (in this case, device 24 a).

Likewise, packet aggregations 36 d and 36 e share similar DNS-query-based device-usage characteristics, in that the respective percentage of DNS queries for each usage category is approximately the same for each of the two packet aggregations. (Also in this case, to ascertain the similarity, the processor may compare the differences between the percentages to relevant thresholds.) The processor therefore groups packet aggregations 36 d and 36 e together, since the similarity between the respective usage characteristics indicates that packet aggregations 36 d and 36 e originated from the same device—in this case, device 24 c.

Packet aggregation 36 c, on the other hand, differs from the other packet aggregations in both its time-based and DNS-query-based usage characteristics. Therefore, the processor does not group packet aggregation 36 c together with any of the other packet aggregations.

By performing the techniques described above with reference to Table 1, the processor may identify the number of devices behind a particular NAT, and/or identify usage characteristics of the devices that may be of interest to the monitoring entity. Hence, even if the processor is unable to extract any persistent identifiers—or any identifiers at all—of the devices, useful information may nonetheless be obtained. Moreover, as described above, communication exchanged with any particular one of the devices may be monitored, even if the particular device moves between networks.

For example, a monitoring entity may use system 20 to monitor communication from one or more particular “target” LANs that use respective NATs. Assuming that the data in Table 1 was acquired by monitoring the LANs, system 20 may use the grouping techniques described above to ascertain that there are three devices that use the LANs. The data also indicate that of the three devices, one of the devices (device 24 a) is used mostly in the mornings and evenings, mainly for checking the news and, to a lesser extent, for social media, and another one of the devices (device 24 b) is used mainly during working hours, primarily for trading stocks. (The last one of the devices, device 24 c, may not have any particular usage characteristics of interest.) This information may then be used, e.g., in combination with information derived from other sources, to learn about the identities, interests, professions, etc. of the people who use the LANs.

In practice, it is usually much more difficult to identify similarities between packet aggregations than is suggested above with reference to Table 1. Hence, processor 34 may use sophisticated machine-learning algorithms to learn rules for grouping packet aggregations together, based on similar device-usage characteristics. For example, the processor may apply any suitable supervised machine-learning algorithm, such as decision trees or forests, used for classification. For such supervised algorithms, “ground truth” may be provided either manually by a user, or automatically, as described in the paragraph immediately below. Alternatively or additionally, the processor may use any suitable unsupervised machine-learning algorithm, such as k-means, for clustering. (In such techniques, the packet aggregations are clustered into different respective clusters, which are equivalent to the “groups” described herein.) Such supervised and unsupervised techniques may learn rules that are based on any of the “features” (i.e., device-usage characteristics) that are described herein, and/or any other suitable features, such as packet sizes, times between packets, operating-system information, etc.

In some embodiments, the processor first computes a characteristic vector for each packet aggregation, where each element in the characteristic vector corresponds to a different respective destination IP address, and the value of this element represents the number of times, in the packet aggregation, that a connection was established with this destination IP address. Typically, each such characteristic vector will have a large number of elements (e.g., between 200,000 and 500,000 elements), most of these elements being zero-valued. (It is noted that the i^(th) element corresponds to the same destination IP address for all of the vectors.) Hence, before processing these vectors, the processor typically reduces the dimensionality of each vector (e.g., using Singular Value Decomposition), such that the vectors may be meaningfully compared to each other. Next, the processor clusters (or “groups”) the packet aggregations, based on similarities between the characteristic vectors. For example, the processor may group two packet aggregations together, in response to the angle between the respective characteristic vectors of these packet aggregations being less than a particular threshold, e.g., 10 degrees.

For example, it will be assumed that, following dimensionality reduction, a first packet aggregation has a characteristic vector (3, 4, 0, 0, 2), and a second packet aggregation has a characteristic vector (6, 7, 1, 1, 4). (In practice, a characteristic vector will typically have more than five elements, even after dimensionality reduction.) In such a case, the two packet aggregations may be clustered together, since the angle between their respective characteristic vectors—which is around nine degrees—is relatively small, indicating similar usage characteristics. In contrast, were the second packet aggregation to have a characteristic vector (0, 1, 6, 4, 0), the two packet aggregations would likely not be clustered together, since their respective characteristic vectors point in very different directions, indicating different usage characteristics.

It is noted that the process of dimensionality reduction may reveal similar usage characteristics between two or more packet aggregations, even if there is relatively little overlap between the destination IP addresses included in these packet aggregations. This is because the process of dimensionality reduction reduces a large number of elements corresponding to different respective IP addresses to a smaller number of elements corresponding to more general usage characteristics, or to relationships between these characteristics. For example, the value of a particular element in a reduced-dimensionality characteristic vector may represent the number of times the device was used to access financial news, or to a ratio of this number to the number of times the device was used to access sporting news. The processor may therefore ascertain that two packet aggregations, acquired on two different days, emanated from the same device, even if the device was not used to access the same financial news or sporting news resources on both of the days.

Notwithstanding the above, in some cases, the processor may group two packet aggregations together based on the destination IP addresses appearing in these packet aggregations, even if the respective characteristic vectors of these packet aggregations are not similar to one another, and even if one of the packet aggregations contains relatively few packets, such as only a single packet. For example, if a first packet aggregation includes a destination IP address that also appears in a second packet aggregation, but does not generally appear in other packet aggregations (i.e., the destination IP address is not commonly accessed by the population at large), the processor may group the first and second packet aggregations together.

It is emphasized that there is a useful synergy between the “device identifier” grouping/association method and the “device-usage characteristic” grouping method, in that the former may automatically provide ground truth that can be used to improve the accuracy of the latter. For example, the processor may extract relevant device-usage characteristics from a plurality of packet aggregations that were collectively associated with a plurality of devices using the “device identifier” method. The extracted device-usage characteristics, and associations with devices, may then be fed to a machine-learning algorithm. Given the set of features (the device-usage characteristics) and the corresponding set of classifications (the respective devices with which the packet aggregations were associated), the machine-learning algorithm may then learn a rule that can be subsequently used to group packet aggregations based on device-usage characteristics.

In some cases, a “quasi-identifier,” which is not uniquely assigned per device, may be used to “fuzzily” associate a packet aggregation with a particular device, i.e., associate the packet aggregation with the device with a particular likelihood that may be significantly less than 100%. Examples of quasi-identifiers include email addresses, operating-system types, and user-agent identifiers. To calculate the likelihood, the processor typically analyzes historically-received packets that were definitively associated with particular devices, e.g., using unique device identifiers such as described above. For example, by analyzing historically-received packets, the processor may ascertain that 90% of the uses of the email address “bob@bobsworld.com” were on device 24 a. In response thereto, the processor may associate a packet aggregation that includes “bob@bobsworld.com” with device 24 a, with a likelihood of 90%. The fuzzy association may then be presented to an operator, and the operator may decide whether to accept or reject the association.

Referring again to FIG. 1, in response to aggregating the packets, extracting device identifiers, associating the packet aggregations with devices, grouping the packet aggregations, and/or any other relevant task associated with the techniques described herein, processor 34 generates an output. The output may comprise, for example, a visual output, displayed on a computer monitor 46, that informs the monitoring entity of the information that has been learned about the target of interest. In some embodiments, the output may follow the monitoring in real-time, informing the user of any relevant developments (such as the formation of a new packet aggregation, or the identification of a particular device identifier), and/or showing current information, such as the current number of packet aggregations. Such output may be presented in multiple levels of detail, such that, for example, by clicking on a particular packet aggregation or group of packet aggregations, the user is able to “dig down” and see details such as device identifiers or quasi-identifiers, device-usage characteristics (such as the top 10 accessed Internet domains), etc.

It will be appreciated by persons skilled in the art that the present invention is not limited to what has been particularly shown and described hereinabove. Rather, the scope of the present invention includes both combinations and subcombinations of the various features described hereinabove, as well as variations and modifications thereof that are not in the prior art, which would occur to persons skilled in the art upon reading the foregoing description. Documents incorporated by reference in the present patent application are to be considered an integral part of the application except that to the extent any terms are defined in these incorporated documents in a manner that conflicts with the definitions made explicitly or implicitly in the present specification, only the definitions in the present specification should be considered. 

1. Apparatus for monitoring a plurality of devices that use a plurality of networks, the apparatus comprising: a network interface; and a processor, configured: to receive, via the network interface, a plurality of packets that were collectively communicated, from the devices, via all of the networks, to aggregate the packets, using at least one field that is included in respective packet headers of the packets, into a plurality of packet aggregations, such that all of the packets in each one of the packet aggregations were collectively communicated from no more than one of the devices, to group the packet aggregations, based on information contained in the packet aggregations, into a plurality of groups, such that there is a one-to-one correspondence between the groups and the devices, in that all of the packets in each of the groups were collectively communicated from a different respective one of the devices, and to generate an output in response to the grouping.
 2. (canceled)
 3. The apparatus according to claim 1, wherein the processor is configured to group the packet aggregations by: for each packet aggregation of the packet aggregations: identifying, in at least one packet of packets belonging to the packet aggregation, at least one device identifier that uniquely identifies the one of the devices from which the packet was communicated, and using the identified device identifier, associating the packet aggregation with the one of the devices from which the packets belonging to the packet aggregation were communicated.
 4. The apparatus according to claim 3, wherein the device identifier is selected from the group consisting of: an Internet cookie, an identifier for advertisers (IDFA), an identifier for vendors (IDFV), an Android advertising identifier (AAID), a universally unique identifier (UUID), an international mobile station equipment identity (IMEI), an international mobile subscriber identity (IMSI), and a media access control (MAC) address.
 5. The apparatus according to claim 3, wherein the processor is configured to identify the device identifier by decoding the at least one packet belonging to the packet aggregation.
 6. The apparatus according to claim 1, wherein the processor is configured to group the packet aggregations by: for each packet aggregation of the packet aggregations: identifying, in at least one packet belonging to the packet aggregation, at least one device identifier, in response to the identified device identifier, calculating a likelihood that the packets belonging to the packet aggregation were communicated from a particular one of the devices, and associating the packet aggregation with the particular one of the devices, with the calculated likelihood.
 7. (canceled)
 8. The apparatus according to claim 1, wherein, in aggregating the packets into the plurality of packet aggregations, the processor is configured to aggregate, into any given packet aggregation of the packet aggregations, any given packet of the packets, in response to at least one of: the given packet belonging to the same transmission control protocol (TCP) connection as does a last-received packet of the given packet aggregation, and a TCP timestamp included in the given packet being within an expected offset range from a TCP timestamp included in the last-received packet of the given packet aggregation.
 9. The apparatus according to claim 8, wherein the processor is further configured to compute the expected offset range by applying a machine-learned model that computes the expected offset range.
 10. The apparatus according to claim 9, wherein the machine-learned model computes the expected offset range by assuming that a rate of increase of the TCP timestamp varies as a function of a time of day.
 11. The apparatus according to claim 1, wherein the processor is configured to group the packet aggregations by: identifying respective device-usage characteristics exhibited by the packet aggregations, and based on the device-usage characteristics, grouping the packet aggregations into the plurality of groups.
 12. The apparatus according to claim 11, wherein the device-usage characteristics are at least partly based on destination internet protocol (IP) addresses included in the packet aggregations.
 13. The apparatus according to claim 12, wherein the processor is configured to group the packet aggregations by: computing, for each packet aggregation of the packet aggregations, a characteristic vector, wherein each element of the vector corresponds to a different respective destination IP address, and a value of the element represents a number of times, in the packet aggregation, that a connection was established with the destination IP address, subsequently, reducing a dimensionality of each characteristic vector, and subsequently, grouping any given first one of the packet aggregations with a second one of the packet aggregations, in response to an angle between the characteristic vector of the first one of the packet aggregations and the characteristic vector of the second one of the packet aggregations being less than a threshold.
 14. (canceled)
 15. The apparatus according to claim 11, wherein the packet aggregations are a second plurality of packet aggregations and the plurality of groups are a second plurality of groups, and wherein the processor is configured to group the second plurality of packet aggregations into the second plurality of groups, by: grouping a first plurality of packet aggregations into a first plurality of groups, based on device identifiers identified in the first plurality of packet aggregations, from the first plurality of groups, learning a rule for grouping packet aggregations based on the device-usage characteristics, and using the rule, grouping the second plurality of packet aggregations into the second plurality of groups.
 16. Apparatus for monitoring a plurality of devices that use at least one network that is serviced by a network address translator (NAT), the apparatus comprising: a network interface; and a processor, configured: to receive, via the network interface, a plurality of packets that were communicated from the devices via the network, to aggregate the packets, using at least one field that is included in respective packet headers of the packets, into a plurality of packet aggregations, such that all of the packets in each one of the packet aggregations were collectively communicated from no more than one of the devices, for each packet aggregation of the packet aggregations: to identify, in at least one packet in the packet aggregation, at least one device identifier that uniquely identifies the one of the devices from which the packet was communicated, and to associate the packet aggregation, based on the identified device identifier, with the one of the devices, and to generate an output in response to the associating.
 17. A method for monitoring a plurality of devices that use a plurality of networks, the method comprising: using at least one field that is included in respective packet headers of a plurality of packets that were collectively communicated from the devices via all of the networks, aggregating the packets into a plurality of packet aggregations, such that all of the packets in each one of the packet aggregations were collectively communicated from no more than one of the devices; based on information contained in the packet aggregations, grouping the packet aggregations into a plurality of groups, such that there is a one-to-one correspondence between the groups and the devices, in that all of the packets in each of the groups were collectively communicated from a different respective one of the devices; and generating an output in response to the grouping.
 18. (canceled)
 19. The method according to claim 17, wherein grouping the packet aggregations comprises: for each packet aggregation of the packet aggregations: identifying, in at least one packet of packets belonging to the packet aggregation, at least one device identifier that uniquely identifies the one of the devices from which the packet was communicated, and using the identified device identifier, associating the packet aggregation with the one of the devices from which the packets belonging to the packet aggregation were communicated.
 20. The method according to claim 19, wherein the device identifier is selected from the group consisting of: an Internet cookie, an identifier for advertisers (IDFA), an identifier for vendors (IDFV), an Android advertising identifier (AAID), a universally unique identifier (UUID), an international mobile station equipment identity (IMEI), an international mobile subscriber identity (IMSI), and a media access control (MAC) address.
 21. The method according to claim 19, wherein identifying the device identifier comprises identifying the device identifier by decoding the at least one packet belonging to the packet aggregation.
 22. The method according to claim 17, wherein grouping the packet aggregations comprises: for each packet aggregation of the packet aggregations: identifying, in at least one packet belonging to the packet aggregation, at least one device identifier, in response to the identified device identifier, calculating a likelihood that the packets belonging to the packet aggregation were communicated from a particular one of the devices, and associating the packet aggregation with the particular one of the devices, with the calculated likelihood.
 23. The method according to claim 17, wherein the field is an internet protocol identification (IPID).
 24. The method according to claim 17, wherein aggregating the packets comprises aggregating, into any given packet aggregation of the packet aggregations, any given packet of the packets, in response to at least one of: the given packet belonging to the same transmission control protocol (TCP) connection as does a last-received packet of the given packet aggregation, and a TCP timestamp included in the given packet being within an expected offset range from a TCP timestamp included in the last-received packet of the given packet aggregation.
 25. (canceled)
 26. (canceled)
 27. (canceled)
 28. (canceled)
 29. (canceled)
 30. (canceled)
 31. (canceled)
 32. (canceled) 